package com.cjjd.c.feature.subscribe.select_hotel;

import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.cjjd.c.R;
import com.cjjd.c.base.MyBaseAdapter;
import com.cjjd.c.bean.subscribe.HotelQuestionShowModel;
import com.cjjd.c.utils.ImageUtil;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * ----------------------------------
 * Created by xyd on 2017/12/1.
 * <p/>
 * 描  述：
 * <p/>
 * 修订历史:
 * ----------------------------------
 */

public class AskAdapter extends MyBaseAdapter {

    public AskAdapter(FragmentActivity mContext) {
        super(mContext);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {


        ViewHolder viewHolder = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_ask, parent, false);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }


        HotelQuestionShowModel itemBean = (HotelQuestionShowModel) getItem(position);
        viewHolder.tvQuestion.setText(itemBean.question);
        viewHolder.tvAnswer.setText(itemBean.answer);
        ImageUtil.displayImage(itemBean.questionerPicPath, viewHolder.ivUser);


        return convertView;
    }

    static class ViewHolder {
        @Bind(R.id.iv_user)
        ImageView ivUser;
        @Bind(R.id.tv_answer)
        TextView tvAnswer;
        @Bind(R.id.tv_question)
        TextView tvQuestion;
        @Bind(R.id.tv_answer_time)
        TextView tvAnswerTime;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
